package org.example.config;

import org.example.util.RequirePermission;

import java.lang.reflect.Method;

/**
 * @author 李新雨的项目86176
 * @version 1.0
 * @date 2024-12-15 14:28
 */
public class AnnoJiXi {
    public static String jiXi() throws ClassNotFoundException {
//        List<String> list=new ArrayList<>();
        String expression=null;
        Class<?> aClass = Class.forName("org.example.controller.HelloController");
        Method[] methods = aClass.getMethods();
        for (Method method : methods) {
            RequirePermission annotation = method.getAnnotation(RequirePermission.class);
            if (annotation != null){
                String name = annotation.name();
                expression = annotation.expression();
//                list.add(expression);
            }
        }
        return expression;
    }

//    public static void main(String[] args) throws ClassNotFoundException {
//        List<String> list = AnnoJiXi.jiXi();
//        for (String expression : list) {
//            System.out.println(expression);
//        }
//    }

}
